import os, time, json, gc, re, warnings, math, glob, traceback, sys, heapq, oss2, requests
import numpy as np
import pandas as pd
from pandas.api.types import is_numeric_dtype
from bs4 import BeautifulSoup
from datetime import datetime, timedelta
from collections import Counter
import nltk
from nltk.tokenize import word_tokenize
from dateutil.relativedelta import relativedelta
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor, as_completed

from openpyxl import Workbook
from openpyxl.utils.dataframe import dataframe_to_rows

from matplotlib import pyplot as plt
from sklearn import metrics
from sklearn.utils.multiclass import type_of_target
from sklearn.metrics import mean_squared_error, roc_auc_score, roc_curve,accuracy_score
from sklearn.model_selection import train_test_split, cross_val_score, KFold
from sklearn.datasets import make_classification

import lightgbm as lgb
from lightgbm import LGBMClassifier
from lightgbm import log_evaluation, early_stopping
from pathlib import Path
import pymysql
from sqlalchemy import create_engine
from scipy.stats import pointbiserialr
from decimal import Decimal, getcontext
from abc import abstractmethod
from abc import ABCMeta

import IPython.display as display
from tqdm import tqdm

tqdm.pandas()


day_str_formart = '%Y-%m-%d'

lgb_params = {
    "task": "train",
    "boosting_type": "gbdt",  # 设置提升类型
    "objective": "regression",  # 目标函数
    "metric": {"auc"},  # 评估函数
    # "max_depth": 2,
    "num_leaves": 2,  # 叶子节点数
    "n_estimators": 800,
    "learning_rate": 0.1,  # 学习速率
    'feature_fraction': 0.8,  # 使用80%的特征
    'bagging_fraction': 0.8,  # 使用80%的样本
    "bagging_freq": 5,  # k 意味看每 k 次迭代执行bagging
    "lambda_l1": 0,
    "lambda_l2": 1000,
    "verbose": -1,
}
